#ifndef QQ_LOG
#define QQ_LOG

#include <qobject.h>
#include <qcoreapplication.h>
#include <qdatetime.h>
#include <qregularexpression.h>

#include <spdlog/spdlog.h>
#include <spdlog/async.h>
#include <spdlog/sinks/basic_file_sink.h>
#include <spdlog/sinks/rotating_file_sink.h>
#include <spdlog/sinks/stdout_color_sinks.h>

#include "QQSettings.h"
#include "QQUtility.h"
#include "QQZipApi.h"

#define qq_log QQLog::get_instance()

class QQLog :public QObject
{
	Q_OBJECT
private:
	QQLog(QObject* parent = nullptr);
	~QQLog();
public:
	void init();
	static QQLog* get_instance();
private:
	static void ub_message_output(QtMsgType type, const QMessageLogContext& context, const QString& msg);
	static void handle_debug(const QString& msg);
	static void handle_info(const QString& msg);
	static void handle_warn(const QString& msg);
	static void handle_error(const QString& msg);
	static void handle_critical(const QString& msg);

	static bool contains_sensitive_data(const QString& msg);

	static void check_handle_compress();
private:
	static std::shared_ptr<spdlog::async_logger> m_async_logger;
};

#endif // QQ_LOG